﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
namespace 作业3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
       
        private void button1_Click(object sender, EventArgs e)
        {
            int a;
            int b;
            int c = 0;
            String s = "";
            string h = "";
            a = Convert.ToInt16(textBox1.Text);
            b = Convert.ToInt16(textBox2.Text);
            for (int i = a; i <= b; i++) 
            {
                bool flag = true;
                for (int j = 2; j < i; j++) // 能被2和到自身的前一个数整除
                {
                    if (i % j == 0)
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    c++;
                    h = Convert.ToString(i);
                    if (c == 10)
                    {
                        s = s + " " + h + "\n";
                        c = 0;
                    }
                    else
                    {
                        s = s + " " + h;
                    }
                }


            }
          

            label4.Text = s;

        }

                private void textBox1_TextChanged(object sender, EventArgs e)
                {

                }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}
